<!--
 * @Autor: Kadia
 * @Date: 2021-07-01 08:21:38
 * @LastEditors: Kadia
 * @Connect: nefukadia@foxmail.com
 * @LastEditTime: 2021-07-01 17:14:44
-->
<template>
    <div v-if="prepare">
        <my-Menu active="3-1" :hasLogin="true"></my-Menu>
        <div class="min-div">
            <div style="width:70%;margin:0 auto;">
                <el-tabs  :tab-position="'left'" v-model="tabIndex">
                    <el-tab-pane lazy label="基本信息">
                        <my-info></my-info>
                    </el-tab-pane>
                    <el-tab-pane lazy label="菜品信息">
                        <my-dish></my-dish>
                    </el-tab-pane>
                </el-tabs>
            </div>
        </div> 
        <my-footer></my-footer>
    </div>
</template>
<script>
import MyDish from './compoenets/myDish.vue';
import myInfo from './compoenets/myInfo.vue';
export default {
  components: { myInfo, MyDish },
    data(){
        return {
            prepare:false,
            tabIndex:'0'
        }
    },
    created () {
        const that=this;
        if(that.$cookies.get('email')!=null&&that.$cookies.get('password')!=null){
            that.$axios({
                url:that.myConfig.manageApiUrl+'/login.php',
                method:'post',
                data:{
                    email:that.$cookies.get('email'),
                    password:that.$cookies.get('password')
                }
            }).then(function(res){
                that.prepare=true;
                if(res.data.errCode==200){
                    that.myConfig.shopId=res.data.shopId;
                }else{
                    that.$cookies.remove('email');
                    that.$cookies.remove('password');
                    that.$router.push({
                        name:'Index'
                    });
                }
            }).catch(function(err){
                that.prepare=false;
                that.$router.push({
                    name:'Index'
                });
            });
        }else{
            that.$router.push({
                name:'Index'
            });
        }
    }
}
</script>
<style scoped>

</style>